<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<%@page import="avicit.platform6.core.locale.PlatformLocalesJSTL"%>
<%@page import="java.util.Locale"%>
<%@page import="avicit.platform6.api.session.SessionHelper"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
		 pageEncoding="UTF-8"%>
<%@ page import="avicit.platform6.commons.utils.ViewUtil"%>
<%@ taglib prefix="sec"
		   uri="/WEB-INF/tags/shiro.tld"%>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>新旧单位部门对应</title>
	<base href="<%=ViewUtil.getRequestPath(request)%>">
	<%@page import="avicit.platform6.api.sysshirolog.impl.AfterLoginSessionProcess"%>
	<%
		Object lang=session.getAttribute(AfterLoginSessionProcess.SESSION_CURRENT_LANGUAGE_CODE);
		String languageCode="zh_CN";
		if(lang!=null){
			languageCode=lang.toString();
		}
		Locale locale =SessionHelper.getLocaleByUser(request);
	%>
	<link href="static/css/custom/lantop/css/custom.css" type="text/css"  rel="stylesheet">
	<jsp:include
			page="/avicit/platform6/component/common/EasyUIJsInclude.jsp"></jsp:include>
	<jsp:include page="/avicit/im/common/ImUIJSCSSInclude.jsp"></jsp:include>
	<script type="text/javascript"
			src="avicit/cbb/businessclass/fondsmanage/locale/language_<%=languageCode%>.js"></script>
	<script type="text/javascript">
		//设置高度
		function getScreenWidth() {
			return window.document.body.offsetWidth - 300;
		}
		var baseurl = "<%=ViewUtil.getRequestPath(request)%>";
		//此事件必须放在jsp中,不能提取到js中,否则不能加载数据
		$(function() {
			//初始化表格数据
			freDataGrid();
		});

		function freDataGrid(){
			$('#compdataGrid').datagrid({
				url : 'platform/CompanyCorrespondenceController/loadCompanyCorrespondence.json'
			});
		}
		/**
		 * 删除新旧单位部门对应
		 */
		function companyCorresDelete() {
			var rows = $('#compdataGrid').datagrid('getSelections');
			var ids = [];
			if (rows.length > 0) {
				$.messager
						.confirm(
								'请确认',
								'您确定要删除当前所选的数据？',
								function(b) {
									if (b) {
										for (var i = 0, length = rows.length; i < length; i++) {
											ids.push(rows[i].ID);
										}
										$.ajax({
													url: 'platform/CompanyCorrespondenceController/deleteCompanyCorrespondence',
													data: {
														ids: ids.join(',')
													},
													type: 'post',
													dataType: 'json',
													success: function(result) {
														if (result.flag == "success") {
															for (var i = 0; i < rows.length; i++) {
																var index = $("#compdataGrid").datagrid("getRowIndex", rows[i]);
																$("#compdataGrid").datagrid("deleteRow", index);
															}
															parent.parent.parent.$.messager.show({
																title: '提示',
																msg: "删除成功！",
																timeout: 2000,
																showType: 'slide'
															});
														} else {
															//failure参数替换'删除失败！'
															$.messager.alert('提示', "删除失败！", 'warning');
														}
													}
												});
									}
								});
			} else {
				$.messager.alert("提示", "请选择要删除的记录！", 'warning');
			}
		}

		//光盘备份任务添加
		function companyCorresAdd() {
			var usd = new CommonDialog("companyCorresAddDialog", "800", "400", "platform/CompanyCorrespondenceController/toCompanyCorrespondenceJsp?dialogId=companyCorresAddDialog", "新旧单位部门对应新增", false, true, true);
			usd.show();
		}
	</script>
	<style type="text/css">
		.textbox {
			border: solid 1px #a5acb5;
		}

		.input,img {
			vertical-align: middle;
		}

		<!--
		实现input和img水平对齐 -->.labelbg {
							   background:
									   url('../../js/jQuery/jquery-easyui-1.3.5/themes/icons/required.gif')
									   right 0 no-repeat;
						   }
	</style>
</head>
<body id="myBody" class="easyui-layout">
<div data-options="region:'center'" style="width: 250px">
	<div id="toolbarDb" class="datagrid-toolbar" style="height: auto; display: block;padding:10px 0;padding-left:5px;">
		<sec:accesscontrollist hasPermission="3" domainObject="ibsckpi_bt_add">
			<%-- 新增 --%>
			<a  style="margin-left: 20px;"  onclick="companyCorresAdd();" title="新增" id="buttonDbAdd" href="javascript:void(0)" class="easyui-linkbutton selbtn">
				<img src="avicit/im/lantop/documents/Filecollection/img/icon_tool08_blue.png"><span class="selbtc">新增</span></a>
		</sec:accesscontrollist>
		<sec:accesscontrollist hasPermission="3" domainObject="ibsckpi_bt_delete">
			<%-- 删除 --%>
			<a onclick="companyCorresDelete();" title="删除" id="buttonDbDelete" href="javascript:void(0)" class="easyui-linkbutton selbtn">
				<img src="avicit/im/lantop/common/search/image/icon_tool835_blue.png"><span class="selbtc">删除</span></a>
		</sec:accesscontrollist>
	</div>
</div>
<div class="easyui-layout" data-options="fit:true">
	<div data-options="region:'center'" style="overflow-y: hidden;">
		<table id="compdataGrid" class="easyui-datagrid"
			   data-options="
					rownumbers: false,
					animate: false,
					collapsible: false,
					fitColumns:true,
					scrollbarSize:0,
					autoRowHeight: false,
					singleSelect: false,
					pagination:true,
					pageNumber:0,
					pageSize:20,
					pageList:[20,30,50],
					toolbar:'#toolbarDb',
		    		striped:true,
					fit:true,
					method: 'post'
				">
			<thead>
			<tr>
				<sec:accesscontrollist  hasPermission="3" domainObject ="LantopCompanyCorrespondence_datagrid_id">
					<th data-options="field:'ID', halign:'center',checkbox:true"
						title="全选" width="20">全选</th>
				</sec:accesscontrollist>
				<%--<sec:accesscontrollist  hasPermission="3" domainObject ="LantopCompanyCorrespondence_datagrid_orgName">
					&lt;%&ndash; 全宗 &ndash;%&gt;
					<th data-options="field:'ORGNAME', halign:'center', align:'center', sortable:false, width: 200"
						title="全宗">全宗</th>
				</sec:accesscontrollist>--%>
				<sec:accesscontrollist  hasPermission="3" domainObject ="LantopCompanyCorrespondence_datagrid_currentDeptName">
					<%-- 现有部门 --%>
					<th
							data-options="field:'CURRENTDEPTNAME', halign:'center', align:'center', sortable:false"
							width="100" title="现有部门">现有部门</th>
				</sec:accesscontrollist>
				<sec:accesscontrollist  hasPermission="3" domainObject ="LantopCompanyCorrespondence_datagrid_counterpartDeptName">
					<%-- 旧部门 --%>
					<th
							data-options="field:'COUNTERPARTDEPTNAME', halign:'center', align:'center', sortable:false"
							width="100" title="旧部门">原有部门</th>
				</sec:accesscontrollist>
			</tr>
			</thead>
		</table>
	</div>
</div>
</div>
</body>
</html>